import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh_flutter3/pull_to_refresh_flutter3.dart';
import 'package:search_people/bean/search/search_list.dart';
import 'package:search_people/page/search/cell.dart';
import 'package:search_people/value/topcolors.dart';

import '../index.dart';

/// hello
class SuperSearchResultWidget extends GetView<SuperSearchController> {
  const SuperSearchResultWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        InkWell(
          onTap: () {
            controller.state.isShowCondition = true;
            controller.update();
          },
          child: Container(
            height: 40.r,
            color: Colors.white,
            alignment: Alignment.center,
            child: Text.rich(
              TextSpan(
                  text: '点击查看',
                  style: TextStyle(color: TopColors.black_33, fontSize: 13.sp),
                  children: [
                    TextSpan(
                      text: '更多条件',
                      style: TextStyle(
                        color: TopColors.main_color,
                        fontSize: 13.sp,
                      ),
                    )
                  ]),
            ),
          ),
        ),
        Expanded(
          child: SmartRefresher(
            controller: controller.state.rc,
            onRefresh: controller.onRefresh,
            onLoading: controller.onLoading,
            enablePullDown: true,
            enablePullUp: true,
            child: ListView.builder(
              itemBuilder: (ctx, idx) {
                var md = controller.state.results[idx];
                return SearchResultCell(words: controller.state.words, md: md);
              },
              itemCount: controller.state.results.length,
            ),
          ),
        )
      ],
    );
  }
}
